import { Controller, Get, Post, Body, Param, Delete, Put, Query } from '@nestjs/common';
import { CouponSort_Service } from './couponSort.service';
import { CouponSort_Create_Dto, CouponSort_Update_Dto } from './assets/couponSort.dto';
import { CouponSort_Find_Dto } from './assets/couponSort.dto';
import { ApiExtraModels, ApiTags } from '@nestjs/swagger';
import { util_ApiResponse_Base } from '@/common/util/apiResponse';
import { util_Index_ReturnContent } from '@/common/util/index';
import { Class_Index_ListAll } from '@/common/classes/index';

@Controller('/adm/couponSort')
@ApiTags('couponSort 优惠券分类')
export class CouponSort_Controller {
  constructor(private readonly couponSort_Service: CouponSort_Service) {}

  @Post('/add')
  @util_ApiResponse_Base({
    dataType: 'dataType_add',
  })
  async couponSort_Create(@Body() body: CouponSort_Create_Dto) {
    return util_Index_ReturnContent(await this.couponSort_Service.couponSort_Create(body));
  }

  @Put('/update')
  @util_ApiResponse_Base({
    dataType: 'dataType_update',
  })
  async couponSort_Update(@Body() body: CouponSort_Update_Dto) {
    return util_Index_ReturnContent(await this.couponSort_Service.couponSort_Update(body));
  }

  @Delete('/delete/:id')
  @util_ApiResponse_Base({
    dataType: 'dataType_delete',
  })
  async couponSort_Remove(@Param('id') id: string) {
    return util_Index_ReturnContent(await this.couponSort_Service.couponSort_Remove(+id));
  }

  @Get('/list')
  @util_ApiResponse_Base({
    dataType: 'dataType_list',
  })
  async platformsort_FindByPage(@Query() query: CouponSort_Find_Dto) {
    return util_Index_ReturnContent(await this.couponSort_Service.couponSort_FindByPage(query));
  }

  @Get('/listSelect')
  @ApiExtraModels(Class_Index_ListAll)
  @util_ApiResponse_Base({
    dataType: 'dataType_list',
    type: Class_Index_ListAll,
  })
  async couponSort_Adm_FindAllSelect(@Query() query: CouponSort_Find_Dto) {
    return util_Index_ReturnContent(await this.couponSort_Service.couponSort_Adm_FindAllSelect(query));
  }
}
